<?php
/**
 * Hesperos library for Zend Framework
 *
 * This script is protected by copyright. It's use, copying, modification
 * and distribution without written consent of the author is prohibited.
 *
 * @category    Hesperos
 * @package     Cache
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2011 Krzysztof Kardasz
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt  GNU Lesser General Public
 * @version     1.0 $Id: Manager.php 8 2011-05-13 11:26:38Z krzysztof.kardasz $
 * @link        http://code.google.com/p/hesperos/
 */

/**
 * Menadżer pamięci podręcznej
 *
 * @category    Hesperos
 * @package     Cache
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2011 Krzysztof Kardasz
 * @version     1.0 $Id: Manager.php 8 2011-05-13 11:26:38Z krzysztof.kardasz $
 */
class Hesperos_Cache_Manager
{
    /**
     * Obiekt klasy Zend_Log
     *
     * @var null|Zend_Cache_Manager
     */
    private static $_manager = null;

    /**
     * Zwraca obiekt klasy Zend_Cache_Manager
     *
     * @return Zend_Cache_Manager
     */
    public static function getManager ()
    {
        if(null === self::$_manager) {
            self::$_manager = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager');
        }
        return self::$_manager;
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getAcl ()
    {
        if(!self::getManager()->hasCache('acl')) {
            return null;
        }
        return self::getManager()->getCache('acl');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getDataBase ()
    {
        if(!self::getManager()->hasCache('database')) {
            return null;
        }
        return self::getManager()->getCache('database');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getI18n ()
    {
        if(!self::getManager()->hasCache('i18n')) {
            return null;
        }
        return self::getManager()->getCache('i18n');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getConfig ()
    {
        if(!self::getManager()->hasCache('config')) {
            return null;
        }
        return self::getManager()->getCache('config');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getMemcached ()
    {
        if(!self::getManager()->hasCache('memcached')) {
            return null;
        }
        return self::getManager()->getCache('memcached');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getPartial ()
    {
        if(!self::getManager()->hasCache('partial')) {
            return null;
        }
        return self::getManager()->getCache('partial');
    }

    /**
     * Zwraca obiekt klasy Zend_Cache
     *
     * @return null|Zend_Cache
     */
    public static function getOther ()
    {
        if(!self::getManager()->hasCache('other')) {
            return null;
        }
        return self::getManager()->getCache('other');
    }
}